fix-new-chat#2103
Conversation
|
I have read the CLA Document and I hereby sign the CLA |
|
Hey @johndev0711 can you please fill in the PR template? You need to link the GH issue that your PR is for as well as provide instructions on how to test your PR and screenshots from each of the platforms listed to show that it works on each platform. Thanks! |
|
I've filled in the PR template already. Thanks |
|
|
||
| if (!hasSelectableOptions && !hasUserToInvite) { | ||
| return CONST.MESSAGES.NO_CONTACTS_FOUND; | ||
| if (/^\d+$/.test(searchValue)) { |
There was a problem hiding this comment.
Does this check if it starts with a 0 ? I don't see it here.
There was a problem hiding this comment.
Yes, you're right.
If it starts with a '0', the country code validation function runs. The function exist already in source code.
Thanks for your kindness.
| * @return {String} | ||
| */ | ||
| function getHeaderMessage(hasSelectableOptions, hasUserToInvite, maxParticipantsReached = false) { | ||
| function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, maxParticipantsReached = false) { |
There was a problem hiding this comment.
If we change a method signature we must update all usages. 🙃

<If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit.>
Details
There are 4 requirements about this GitHub issue, that is, 1. "Remove the feedback... ", 2. "When typing... ... ... show what they've typed below, but greyed out and unselectable.", 3. "... ... ... show the option as selectable(as we do today)", 4. "Phone number validation... 'please enter... ... ... the country code...'"All of them are related with the getHeaderMessage function in OptionsListUtils.js.
This getHeaderMessage function has 2 props as the original props: hasSelectableOptions, hasUserToInvite.
We have to add a props - searchValue to them, this used to implement the second and fourth requirements.
Also, we have to change the createNewChat function of the NewChatPage.js by adding this.state.searchValue. Here this.state.searchValue has the inputted value. And this value show the feedback according to the second requirement.
For solving the fourth requirement, we have to do validation with the inputted value (searchValue).
This problem has been solved easily by using simple JavaScript validation code.
Additionally, I've changed the default messages in CONST.js with the message of the fourth requirement.
Fixed Issues
#1968
Tests
Running the web app: npm run build/npm run web
Running the MacOS desktop app: npm run desktop-build/npm run desktop
Running the iOS app: npm run ios-build/npm run ios
Android app: npm run android-build /npm run android
For example, abcde@fgs : show what they've typed below, but greyed out and unseletable.
abcde@fgs.com : show the option as selectable.
For example, 123..(.number) => Show the selectable phone number, 012...(number) => Show message please enter ...,
All testing results have added as following attachments(screenshots)
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android